from launch import LaunchDescription
from launch_ros.actions import Node
# 封装终端指令相关类--------------
# from launch.actions import ExecuteProcess
# from launch.substitutions import FindExecutable
# 参数声明与获取-----------------
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
# 文件包含相关-------------------
# from launch.actions import IncludeLaunchDescription
# from launch.launch_description_sources import PythonLaunchDescriptionSource
# 分组相关----------------------
# from launch_ros.actions import PushRosNamespace
# from launch.actions import GroupAction
# 事件相关----------------------
# from launch.event_handlers import OnProcessStart, OnProcessExit
# from launch.actions import ExecuteProcess, RegisterEventHandler,LogInfo
# 获取功能包下share目录路径-------
# from ament_index_python.packages import get_package_share_directory
# import os
""" 
    需求：演示Node使用
    构造函数参数说明：

        :param: executable 可执行程序；T
        :param: package 被执行的程序所属的功能包；T
        :param: name 节点名称；T
        :param: namespace 设置命名空间；T
        :param: exec_name 设置程序标签；F
        :param: parameters 设置参数；F
        :param: remappings 话题重映射
        :param: ros_arguments 为节点传参
                            --ros-args xx yy
        :param: arguments 为节点传参
                            xx yy --ros-args

 """

def generate_launch_description():
       # 声明一个名为child_link的启动参数，类型为字符串，默认值为空字符串
        child_link = DeclareLaunchArgument(
                'child_link',
                default_value='',
                description='Value for the child_link parameter'
           )
        
        pose_unstamper = Node(
           package="odom_zuzhuang",#要启动的节点
           executable="pose_unstamper",
           name="poseandtwist_unstamper"
           )#（功能包，可执行程序，名字）
        posewithcovariance = Node(
           package="odom_zuzhuang",#要启动的节点
           executable="posewithcovariance",
           name="pose_covariance"
           )
        odom_enu = Node(
           package="odom_zuzhuang",#要启动的节点
           executable="odom_enu",
           name="odom_enu",
           parameters=[
            {'child_link': LaunchConfiguration('child_link')}  # 将启动参数传递给节点的参数
                ]
           )
        rename_imu = Node(
           package="odom_zuzhuang",#要启动的节点
           executable="rename_imu",
           name="rename_imu"
           )

        return LaunchDescription([
                pose_unstamper,
                posewithcovariance,
                odom_enu,
                rename_imu,
                child_link,
                ])
    